package com.crois.barrier.admin.resp;

import com.crois.barrier.admin.spring.SpringBeanUtils;
import com.crois.barrier.common.exception.BarrierException;
import com.crois.barrier.common.exception.BarrierExceptionEnum;
import com.crois.barrier.common.response.BarrierResponse;
import com.crois.barrier.common.response.BarrierResponseEntity;
import java.util.List;

/**
 * @author Hou Ze Yu
 * @description
 * @date 2020/10/23
 */
public final class BarrierResponseWrapper {

    public static BarrierResponseEntity<Void> ok(){

        BarrierResponse<BarrierResponseEntity<Void>> doorResponse = SpringBeanUtils.getInstance().getBean(BarrierResponse.class);

        return doorResponse.ok();

    }

    public static BarrierResponseEntity<?> ok(Object data){

        BarrierResponse<BarrierResponseEntity<?>> doorResponse = SpringBeanUtils.getInstance().getBean(BarrierResponse.class);

        return doorResponse.ok(data) ;
    }
    public static BarrierResponseEntity<List<?>> okList(List<?> list){
        BarrierResponse<BarrierResponseEntity<List<?>>> doorResponse = SpringBeanUtils.getInstance().getBean(BarrierResponse.class);
        return doorResponse.okList(list) ;
    }
    public static BarrierResponseEntity<Void> fail(){
        BarrierResponse<BarrierResponseEntity<Void>> doorResponse = SpringBeanUtils.getInstance().getBean(BarrierResponse.class);
        return doorResponse.fail();
    }

    public static BarrierResponseEntity<Void> fail(BarrierException doorException){
        BarrierResponse<BarrierResponseEntity<Void>> doorResponse = SpringBeanUtils.getInstance().getBean(BarrierResponse.class);
        return doorResponse.fail(doorException);
    }
    public static BarrierResponseEntity<Void> fail(BarrierExceptionEnum doorExceptionEnum){
        BarrierResponse<BarrierResponseEntity<Void>> doorResponse = SpringBeanUtils.getInstance().getBean(BarrierResponse.class);
        return doorResponse.fail(doorExceptionEnum);
    }
}
